//
//  UnderlinedButton.m
//  KiklinkApp
//
//  Created by LF on 14/10/21.
//  Copyright (c) 2014年 Kiklink. All rights reserved.
//

#import "UnderlinedButton.h"

@implementation UnderlinedButton

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

//须在界面编辑器中使用AttributedString
-(void)setUnderline
{
    //	NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:self.currentTitle];
    NSMutableAttributedString *content = [[self attributedTitleForState:UIControlStateNormal]mutableCopy];
    NSRange contentRange = {0, [content length]};
    [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
    [self setAttributedTitle:content forState:UIControlStateNormal];
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self setUnderline];
}

@end
